added GtkArrow::arrow-scaling style property to control the arrow/border
authorTim Janik <timj@imendio.com>
Tue, 19 Sep 2006 15:51:19 +0000 (15:51 +0000)
committerTim Janik <timj@src.gnome.org>
Tue, 19 Sep 2006 15:51:19 +0000 (15:51 +0000)
Tue Sep 19 17:00:04 2006  Tim Janik  <timj@imendio.com>

        * gtk/gtkarrow.c: added GtkArrow::arrow-scaling style property to
        control the arrow/border ratio within the allocation.

        * tests/testgtk.c: added a GtkArrow to handle box test.

        * tests/testgtkrc: test ::arrow-scaling property.

ChangeLog
gtk/gtkarrow.c
tests/testgtk.c
tests/testgtkrc

index 9171dd076e01a11c0f1a127aa426153612c3c680..347f0a3f764758c7b265429b3f73c888e8eb7fd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Tue Sep 19 17:00:04 2006  Tim Janik  <timj@imendio.com>
+
+       * gtk/gtkarrow.c: added GtkArrow::arrow-scaling style property to 
+       control the arrow/border ratio within the allocation.
+
+       * tests/testgtk.c: added a GtkArrow to handle box test.
+
+       * tests/testgtkrc: test ::arrow-scaling property.
+
 2006-09-19  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkfilechooserdefault.c (update_current_folder_get_info_cb):
index 45f024d61328ca5a6bd2993120abf33343cc9b42..2a2427410b03b2555e4ac26f131b4ea4158dece3 100644 (file)
@@ -86,7 +86,13 @@ gtk_arrow_class_init (GtkArrowClass *class)
                                                      GTK_TYPE_SHADOW_TYPE,
                                                      GTK_SHADOW_OUT,
                                                       GTK_PARAM_READWRITE));
-  
+  gtk_widget_class_install_style_property (widget_class,
+                                           g_param_spec_float ("arrow-scaling",
+                                                               P_("Arrow Scaling"),
+                                                               P_("Amount of space sed up by arrow"),
+                                                               0.0, 1.0, 0.7,
+                                                               GTK_PARAM_READABLE));
+
   widget_class->expose_event = gtk_arrow_expose;
 }
 
@@ -204,8 +210,6 @@ static gboolean
 gtk_arrow_expose (GtkWidget      *widget,
                  GdkEventExpose *event)
 {
-  GtkArrow *arrow;
-  GtkMisc *misc;
   GtkShadowType shadow_type;
   gint width, height;
   gint x, y;
@@ -215,12 +219,14 @@ gtk_arrow_expose (GtkWidget      *widget,
 
   if (GTK_WIDGET_DRAWABLE (widget))
     {
-      arrow = GTK_ARROW (widget);
-      misc = GTK_MISC (widget);
+      GtkArrow *arrow = GTK_ARROW (widget);
+      GtkMisc *misc = GTK_MISC (widget);
+      gfloat arrow_scaling;
+      gtk_widget_style_get (widget, "arrow-scaling", &arrow_scaling, NULL);
 
       width = widget->allocation.width - misc->xpad * 2;
       height = widget->allocation.height - misc->ypad * 2;
-      extent = MIN (width, height) * 0.7;
+      extent = MIN (width, height) * arrow_scaling;
       effective_arrow_type = arrow->arrow_type;
 
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
index e12089ada072737e2207c88fb866317ebaf6ab52..c7274e05b87bd1f90da889dc3f36ff911537c1b4 100644 (file)
@@ -2389,9 +2389,11 @@ create_handle_box (GtkWidget *widget)
                      "detached");
     gtk_widget_show (handle_box2);
 
+    hbox = g_object_new (GTK_TYPE_HBOX, "visible", 1, "parent", handle_box2, NULL);
     label = gtk_label_new ("Fooo!");
-    gtk_container_add (GTK_CONTAINER (handle_box2), label);
+    gtk_container_add (GTK_CONTAINER (hbox), label);
     gtk_widget_show (label);
+    g_object_new (GTK_TYPE_ARROW, "visible", 1, "parent", hbox, NULL);
   }
 
   if (!GTK_WIDGET_VISIBLE (window))
index f711ae79bdbae90c068a8f095f802f9c690058bf..e94ab284b7ce0766878f7961d33539afb5ec3703 100644 (file)
@@ -31,6 +31,7 @@ style "global-style-properties"
   GtkToolbar::button_relief = none
   GtkButtonBox::child_min_width = 0
   GtkButtonBox::child_min_height = 0
+  GtkArrow::arrow-scaling = 1.0
 }
 class "GtkWidget" style "global-style-properties"